# -- coding: utf-8 --

from sys import argv

script, filename = argv

print(f"We will erase {filename}.")
print("If you don't want that, hit CTRL-C (^C).")
print("If you do want that, hit RETURN.")

input('? ')

print("Opening file ...")
target = open(filename, 'w+')

print("Truncating the file ...")
target.truncate()

print(f"Now you can give me three lines to write to the file {filename}")

line1 = input("line1: ")
line2 = input("line2: ")
line3 = input("line3: ")

print("Writting file ...")

target.write(line1 + "\n" + line2 + "\n" + line3 + "\n")

print(f"Here below is the contents of file {filename}")
target.seek(0)
print(target.read())

print("Closing file ...")
target.close()

